** Load the orginal data
** Analyses performed using Stata/SE 18.0 for Mac (Apple Silicone) Revision 14 Feb 2024

	use "/Desktop/JBB Replication Raw Data.dta"


** Remove one person dropped for entering invalid response for age
	drop if age==3
	
** Dependent Variables 
	* Threat DVs
		rename threat_1 threat_women
		rename threat_2 threat_race
		rename threat_3 threat_ethnic
		rename threat_4 threat_men
		rename threat_5 threat_whites

	* Fairness DVs	
		rename fairness_1 fair_women
		rename fairness_2 fair_race
		rename fairness_3 fair_eth
		
** Treatment Conditions (Independent Variables)

	* Treatment Condition 
		gen Treat = 0 if vignettescontrol_do== "con_ticket"
		replace Treat = 1 if vignettescontrol_do== "con_car"
		replace Treat = 2 if vignettesethnicity_do== "ethnot physical"
		replace Treat = 3 if vignettesethnicity_do== "ethphysical"
		replace Treat = 4 if vignettesgender_do== "G1not physical"
		replace Treat = 5 if vignettesgender_do== "G1physical"
		replace Treat = 6 if vignettesgender2_do== "G2not physical"
		replace Treat = 7 if vignettesgender2_do== "G2physical "
		replace Treat = 8 if vignettesrace_do== "Rnot physical"
		replace Treat = 9 if vignettesrace_do== "Rphysical"

** Coding Control Variables (for descriptive info on sample and full model in appendix)
	** Female
		gen Female = 1 if gender==2 
		replace Female=0 if Female==.
	
	** Party ID = 1 Independent, 2 Democrat, 3 Republican (includes leaners)
		gen PID = 1 if party== 4 & leaner == 3
		
		replace PID = 2 if party==1
		replace PID = 2 if party==2
		replace PID = 2 if party==3
		replace PID = 2 if party==4 & leaner== 1
		
		replace PID = 3 if party==5
		replace PID = 3 if party==6
		replace PID = 3 if party==7
		replace PID = 3 if party==4 & leaner== 2
	
	** Conservatism 
		gen Conservatism = ideology
	
	** white
		gen white= 1 if race=="5"
		replace white = 0 if white==. 
		
		gen black = 1 if race=="3"
		replace black = 0 if black ==.
		
	** ethnicity 
		gen hispanic = 1 if ethnicity==1
		replace hispanic = 0 if hispanic==.
	
	** income
		destring income, replace
	
	** racial resentment 
		label variable racial_resent_1 "discrim. creates hardship"
		label variable racial_resent_2 "other minorities worked up"
		label variable racial_resent_3 "not trying hard enough"
		label variable racial_resent_4 "less than deserve"
		
		replace racial_resent_2 = 0 if racial_resent_2==1
		replace racial_resent_2 = 1 if racial_resent_2==2
		replace racial_resent_2 = 2 if racial_resent_2==3
		replace racial_resent_2 = 3 if racial_resent_2==4
		replace racial_resent_2 = 4 if racial_resent_2==5
		
		replace racial_resent_3 = 0 if racial_resent_3==1
		replace racial_resent_3 = 1 if racial_resent_3==2
		replace racial_resent_3 = 2 if racial_resent_3==3
		replace racial_resent_3 = 3 if racial_resent_3==4
		replace racial_resent_3 = 4 if racial_resent_3==5
		
		gen rr_1 = 0 if racial_resent_1 == 5
		replace rr_1 = 1 if racial_resent_1 == 4
		replace rr_1 = 2 if racial_resent_1 == 3
		replace rr_1 = 3 if racial_resent_1 == 2
		replace rr_1 = 4 if racial_resent_1 == 1
		
		gen rr_4 = 0 if racial_resent_4 == 5
		replace rr_4 = 1 if racial_resent_4 == 4
		replace rr_4 = 2 if racial_resent_4 == 3
		replace rr_4 = 3 if racial_resent_4 == 2
		replace rr_4 = 4 if racial_resent_4 == 1
	
		gen racial_resentment = racial_resent_2 + racial_resent_3 + rr_1 + rr_4
	
	** ethnic resentment 
		label variable ethnic_resentment_1 "discrim. creates hardship"
		label variable ethnic_resentment_2 "other minorities worked up"
		label variable ethnic_resentment_3 "not trying hard enough"
		label variable ethnic_resentment_4 "less than deserve"
		
		replace ethnic_resentment_2 = 0 if ethnic_resentment_2==1
		replace ethnic_resentment_2 = 1 if ethnic_resentment_2==2
		replace ethnic_resentment_2 = 2 if ethnic_resentment_2==3
		replace ethnic_resentment_2 = 3 if ethnic_resentment_2==4
		replace ethnic_resentment_2 = 4 if ethnic_resentment_2==5
		
		replace ethnic_resentment_3 = 0 if ethnic_resentment_3==1
		replace ethnic_resentment_3 = 1 if ethnic_resentment_3==2
		replace ethnic_resentment_3 = 2 if ethnic_resentment_3==3
		replace ethnic_resentment_3 = 3 if ethnic_resentment_3==4
		replace ethnic_resentment_3 = 4 if ethnic_resentment_3==5
		
		gen er_1 = 0 if ethnic_resentment_1 == 5
		replace er_1 = 1 if ethnic_resentment_1 == 4
		replace er_1 = 2 if ethnic_resentment_1 == 3
		replace er_1 = 3 if ethnic_resentment_1 == 2
		replace er_1 = 4 if ethnic_resentment_1 == 1
		
		gen er_4 = 0 if ethnic_resentment_4 == 5
		replace er_4 = 1 if ethnic_resentment_4 == 4
		replace er_4 = 2 if ethnic_resentment_4 == 3
		replace er_4 = 3 if ethnic_resentment_4 == 2
		replace er_4 = 4 if ethnic_resentment_4 == 1
		
		gen ethnic_resentment = ethnic_resentment_2 + ethnic_resentment_3 + er_1 + er_4
	
	** Sexism 
		gen s2 = .	
		replace s2 = 0 if sexism2==1
		replace s2 = 1 if sexism2==2
		replace s2 = 2 if sexism2==3
		replace s2 = 3 if sexism2==4
		replace s2 = 4 if sexism2==5
		
		gen s1 = 0 if sexism1 == 5
		replace s1 = 1 if sexism1 == 4
		replace s1 = 2 if sexism1 == 3
		replace s1 = 3 if sexism1 == 2
		replace s1 = 4 if sexism1 == 1

		gen TotSexism = s2 + s1
	
	** Political Knowledge
		gen pk1 = 1 if harris==4
		replace pk1 = 0 if pk1==.
		
		gen pk2 = 1 if scotus==3
		replace pk2 = 0 if pk2==.
		
		gen pk3 = 1 if chief==3
		replace pk3 = 0 if pk3==.
		
		gen pk4 = 1 if majority==2
		replace pk4 = 0 if pk4==. 
		
		gen PoliKnow = pk1 + pk2 + pk3 + pk4
	
	** Political Interest
		gen PoliInterest = interest1 + interest3

*** ANALYSES IN MANUSCRIPT
	
	* install package for coefficient plots 
		ssc install coefplot, replace

	** Figure 1: Threat
			regress threat_women i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism

			estimates store threat_women

			regress threat_race i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 

			estimates store threat_racial

			regress threat_ethnic i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 

			estimates store threat_ethnic 

			coefplot threat_women || threat_racial || threat_ethnic, keep(*.Treat) xline(0) byopts(col(3))

	* Notes on discussion of findings on pages 8 - 9 of manuscript. The p-values from coefficients for Treat 1 (physical control) in each of the three models above are reported on page 8. The example of the non-physical sexual harassment condition uses the coefficient estimates for Treat 6 in each of the three models. On page 9 the coefficients for Treat 3 (phyiscal ethnic discr. condition) were reported. 

			
	** Figure 2: Fairness
				
			regress fair_women i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism

			estimates store fair_women

			regress fair_race i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 

			estimates store fair_race

			regress fair_eth i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 

			estimates store fair_ethnic 
		

			coefplot fair_women || fair_race || fair_ethnic, keep(*.Treat) xline(0) byopts(col(3))

			

*** SUPPLEMENTARY MATERIAL (APPENDIX)

	** Section A: Descriptive Statistics on Respondent Demographics
		tab PID
		tab ideology
		tab gender
		sum age, d
		tab race
		tab hispanic
		sum PoliKnow, d
		sum PoliInterest, d
		tab income
		sum racial_resentment, d
		sum ethnic_resentment, d
		sum TotSexism, d
	
	** Section B: Number of Respondents by Condition 
		tab Treat
	
	** Section C: Means of Dependent Variable by Treatment Condition
		* Table A2
			tabstat threat_women, by(Treat)
			tabstat threat_race, by(Treat)
			tabstat threat_ethnic, by(Treat)
		
		* Table A3
			tabstat fair_women, by(Treat)
			tabstat fair_race, by(Treat)
			tabstat fair_eth, by(Treat)
	
	** Section D: Attention Checks
		tab judge_gender
		tab judge_ideo
	
	** Section E: Models with Control Variables 
		** Table A4 
			* Threat to women
				regress threat_women i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism
			* Threat to racial minorities
				regress threat_race i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Threat to ethnic minorities
				regress threat_ethnic i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
				
		** Table A5
			* Women
				regress fair_women i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Racial minorities
				regress fair_race i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Ethnic minorities 
				regress fair_eth i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism
	
	** Section F: Comparing Effect Sizes
		* Collapse Treatment to compare effect sizes across treatments (0 control, 1 ethnicity, 2 gender, 3 race) 
			* control 
			gen Treatment_Coll = 0 if Treat==0
			replace Treatment_Coll = 0 if Treat==1
	
		* ethnicity 
			replace Treatment_Coll =1 if Treat==2
			replace Treatment_Coll =1 if Treat==3

		* gender
			replace Treatment_Coll =2 if Treat==4
			replace Treatment_Coll =2 if Treat==5
			replace Treatment_Coll =2 if Treat==6
			replace Treatment_Coll =2 if Treat==7
	
		* race	
			replace Treatment_Coll =3 if Treat==8
			replace Treatment_Coll =3 if Treat==9
					
		* Table A6: Women baseline
			* Threat to Women
				regress threat_women ib2.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Threat to racial minorities
				regress threat_race ib2.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Threat to ethnic minorities
				regress threat_ethnic ib2.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Rule fairly women
				regress fair_women ib2.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Rule fairly racial minorities 
				regress fair_race ib2.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism  
			* Rule fairly ethnic minorities 
				regress fair_eth ib2.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
		
		* Table A7: racial minorities baseline
			* Threat to women
				regress threat_women ib3.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Threat to racial minorities 
				regress threat_race ib3.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Threat to ethnic minorities 
				regress threat_ethnic ib3.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Rule fairly women
				regress fair_women ib3.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Rule fairly racial minorities 
				regress fair_race ib3.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism  
			* Rule fairly ethnic minorities 
				regress fair_eth ib3.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 		
	
		* Table A8: ethnic minorities baseline
			* Threat to Women
				regress threat_women ib1.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Threat to racial minorities
				regress threat_race ib1.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Threat to ethnic minorities 
				regress threat_ethnic ib1.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Rule fairly women
				regress fair_women ib1.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 
			* Rule fairly racial minorities 
				regress fair_race ib1.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism  
			* Rule fairly ethnic minorities 
				regress fair_eth ib1.Treatment_Coll i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism 

	** Section G: Group-Specific Responses
		* Table A9: Group-Specific Responses
			* Threat to men 
				regress threat_men i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism
			* Threat to whites
				regress threat_whites i.Treat i.Female i.PID Conservatism i.white income racial_resentment ethnic_resentment TotSexism
		
	** Section I: Respondent Party
		* independents (42.81 + 24.69 + 9.38 = 76.88% )
			tab infer_judge_ideo if PID == 1
		* democrats (28.67 + 37.25 + 20.48 = 86.4%)
			tab infer_judge_ideo if PID == 2
		* republicans (40.74 + 22.08 + 7.26 = 70.08%)
			tab infer_judge_ideo if PID == 3
		
		* Table A10: Republicans Only
			* Threat to women
				regress threat_women i.Treat i.Female Conservatism i.white income racial_resentment ethnic_resentment TotSexism if PID==3
			* Threat to racial minorities
				regress threat_race i.Treat i.Female Conservatism i.white income racial_resentment ethnic_resentment TotSexism if PID==3
			* Threat to ethnic minorities
				regress threat_ethnic i.Treat i.Female Conservatism i.white income racial_resentment ethnic_resentment TotSexism if PID==3
			
		